package com.sunyard.manage.service;

import com.sunyard.dal.bo.*;
import com.sunyard.dal.bo.device.*;
import com.sunyard.dal.bo.device.key.KeyUploadLogBO;
import com.sunyard.dal.bo.task.OrgBO;
import com.sunyard.dal.bo.task.SingleLockBo;
import com.sunyard.dal.dto.TerminalCopyDTO;
import com.sunyard.dal.dto.TerminalCopyReslutDTO;
import com.sunyard.dal.dto.TerminalDTO;
import com.sunyard.dal.dto.TerminalQueryResDTO;
import com.sunyard.dal.dto.znsTask.OrgDTO;
import com.sunyard.dal.dto.znsTask.OperatorDTO;
import com.sunyard.dal.entity.Terminal;
import com.sunyard.dal.entity.TerminalCopy;
import com.sunyard.utils.Response.BaseResult;
import com.sunyard.utils.manage.DataGrid;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

public interface TerminalService {
    /**
     * 分页查询终端信息
     *
     * @param queryBO
     * @param request [queryBO, request]
     * @return BaseResult<DataGrid < TerminalQueryResDTO>>
     **/
    BaseResult<DataGrid<TerminalQueryResDTO>> getTerminalByPage(PaginationBO<TerminalQueryBO> queryBO, HttpServletRequest request) throws Exception;

    BaseResult<TerminalQueryResDTO> getTerminalByMac(TerminalMacBO terminalMacBO, HttpServletRequest request);

    /**
     * 分页查询终端审核信息
     *
     * @param queryBO
     * @param request [queryBO, request]
     * @return BaseResult<DataGrid < TerminalQueryResDTO>>
     **/
    BaseResult<DataGrid<TerminalCopyReslutDTO>> queryAuditInfo(PaginationBO<TerminalCopyDTO> queryBO, HttpServletRequest request) throws Exception;

    void terminalAuditExport(HttpServletResponse response,TerminalCopyDTO terminalCopyDTO, HttpServletRequest request);

    BaseResult<Map<String, TerminalCopy>> selectAuditInfo(TerminalCopyDTO terminalCopyDTO, HttpServletRequest request) throws Exception;

    BaseResult<TerminalCopy> audit(TerminalCopyDTO terminalCopyDTO, HttpServletRequest request);


    /**
     * 添加终端信息
     *
     * @param addBO
     * @param request [addBO, request]
     * @return BaseResult
     **/
    BaseResult addTerminal(TerminalAddBO addBO, HttpServletRequest request) throws Exception;

    /**
     * 修改终端信息
     *
     * @param updateBO
     * @param request  [updateBO, request]
     * @return BaseResult
     **/
    BaseResult updateTerminal(TerminalUpdateBO updateBO, HttpServletRequest request);

    /**
     * 删除终端信息
     *
     * @param deleteBO
     * @param request  [deleteBO, request]
     * @return BaseResult
     **/
    BaseResult deleteTerminal(TerminalDeleteBO deleteBO, HttpServletRequest request);

    /**
     * 终端启用停用
     *
     * @param updateStateBO [updateStateBO]
     * @return BaseResult
     **/
    BaseResult updateState(TerminalUpdateStateBO updateStateBO, HttpServletRequest request);

    /**
     * 终端信息导出
     *
     * @param request
     * @param response [request, response]
     * @return BaseResult
     **/
    /* BaseResult exportTerminal(HttpServletRequest request, HttpServletResponse response) throws Exception;*/

    BaseResult<Integer> selectCount(TerminalDTO dto, HttpServletRequest request);

    BaseResult exportTerminal(PaginationBO<TerminalQueryBO> queryBO, HttpServletRequest request, HttpServletResponse response) throws Exception;

    /**
     * 上传操作日志
     *
     * @param uploadLogBO
     * @param request     [uploadLogBO, request]
     * @return BaseResult
     * @author: guangw.dang
     * @Date: 2022/7/15 15:01
     **/
    BaseResult uploadLog(KeyUploadLogBO uploadLogBO, HttpServletRequest request) throws ParseException;

    BaseResult openSwitch(TerminalDTO dto, HttpServletRequest request);

    BaseResult<Terminal> track(TerminalDTO dto, HttpServletRequest request);

    void openOne(String id);

    BaseResult openTwo(TerminalDTO dto, HttpServletRequest request);

    BaseResult openThree(TerminalDTO dto, HttpServletRequest request);

    BaseResult importInfo(HttpServletRequest request, TerminalCopyDTO terminalDTO, MultipartFile multipartFile) throws Exception;

    BaseResult saveTrunkData(TerminalDTO dto, HttpServletRequest request);

    BaseResult<List<Terminal>> selectLockAll(HttpServletRequest request);

    BaseResult getDate(HttpServletRequest request);


    BaseResult sign(TerminalSignBO signBO, HttpServletRequest request);

    BaseResult batchDeleteTerminal(TerminalBatchDeleteBO deleteBO, HttpServletRequest request);

    BaseResult batchUpdateState(TerminalBatchUpdateStateBO updateStateBO, HttpServletRequest request);

    BaseResult<TerminalCopy> batchAudit(TerminalAuditBO queryBO, HttpServletRequest request);

    BaseResult<List<OrgDTO>> getOperateBySn(HttpServletRequest request, TerminalSnBO terminalSnBO);

    BaseResult initLock(TerminalInitBO initBO, HttpServletRequest request);

    BaseResult resetLock();

    BaseResult checkKey(TerminalSignBO signBO, HttpServletRequest request);

    BaseResult<List<OperatorDTO>> findOperatorByOrg(OrgBO orgBO, HttpServletRequest request);

    BaseResult<List<OperatorDTO>> findOperatorByOrgAndTaskType(SingleLockBo singleLockBo, HttpServletRequest request);

    BaseResult getCurrentTime();
}
